package se.ytterman.jpcap.jni;

import java.lang.*;
import java.util.*;

import se.ytterman.jpcap.pcap.PcapPacket;

public class PcapSocket {

    PcapSocket() {
	this.pcap_t_ptr = 0;
	this.parent_ifc = null;
    }

    // Fetch parent interface
    public PcapInterface getParentInterface() {
	return this.parent_ifc;
    }

    // toString
    public String toString() {
	return ("PcapSocket.toString: " + Long.toString(this.pcap_t_ptr));
    }

    // Apply PCAP (tcpdump) filter
    public native void setFilter(String pcap_filter);

    // Read from socket (native)
    public native void read(PcapPacket packet);

    // Write to socket (native)
    public native void write(PcapPacket packet);

    // Close socket (native)
    public native void close();

    // Properties
    private long pcap_t_ptr;

    private PcapInterface parent_ifc;
}
